<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>taobaoke api test</title>
    <script src="http://cdn.uuola.cn/js/txbase.js"></script>
    <script src="http://nap.uuola.com/olatao/initTbkCookie"></script>
</head>
<body>
<p id="tbk_item"></p>
    <script src="http://l.tbcdn.cn/apps/top/x/sdk.js?appkey=21385803"></script>
    <script>
        function  getTbkItem(item_id){
            if(va.isnull(item_id)){
                return;
            }
            var tknick;
            if(TOP.auth. getUser()!=null){
                var usernameObj=TOP.auth.getUser();
                tknick=usernameObj.nick;
            }else{
                tknick="";
            }
            TOP.api('rest', 'get',{
                method:'taobao.taobaoke.widget.items.convert',
                nick:tknick,
                num_iids:item_id,
                fields:'num_iid,click_url,commission,pic_url,price,promotion_price'
            },function(resp){
                if(resp.error_response){
                    alert('taobao.taobaoke.widget.items.convert接口获取商品信息品失败!'+resp.error_response.msg);
                    return false;
                }
                var respItem=resp.taobaoke_items.taobaoke_item;
                var outHtml = [];
                for(var i=0;i<respItem.length;i++){
                   outHtml.push(
                           '<img src="'+respItem[i].pic_url+'_300x300.jpg" />' +
                           '<br/>'+respItem[i].num_iid + '; 售价:' + respItem[i].price  +
                           '<br/> 促销价：'+respItem[i].promotion_price  +
                           '<br/>佣金:' + respItem[i].commission +
                           '; <br/>click_url: '+respItem[i].click_url
                   );
                }
                $('#tbk_item').html(outHtml.join(''));
            })
        };

        // test
        getTbkItem(ut.get('id'));
    </script>
</body>
</html>